/**
 * 
 */
package com.swim.natatoriumgoods.entity;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 游泳馆商品Entity
 * @author tql
 * @version 2021-03-14
 */
@Table(name="t_natatorium_goods", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="natatorium_info_id", attrName="natatoriumInfoId", label="游泳馆id"),
		@Column(name="name", attrName="name", label="商品名称", queryType=QueryType.LIKE),
		@Column(name="goods_type", attrName="goodsType", label="商品类型", comment="商品类型 1表示游泳票 2表示培训课程 3表示体验课程"),
		@Column(name="course_number", attrName="courseNumber", label="课程人数"),
		@Column(name="course_start_time", attrName="courseStartTime", label="课程开始时间"),
		@Column(name="course_end_time", attrName="courseEndTime", label="课程结束时间"),
		@Column(name="original_price", attrName="originalPrice", label="原价"),
		@Column(name="price", attrName="price", label="价格"),
		@Column(name="number", attrName="number", label="库存数量"),
		@Column(name="sell_number", attrName="sellNumber", label="已售数量"),
		@Column(name="use_finish_time", attrName="useFinishTime", label="使用截至时间"),
		@Column(name="up_sell_time", attrName="upSellTime", label="上架时间"),
		@Column(name="down_sell_time", attrName="downSellTime", label="下架时间"),
		@Column(name="goods_status", attrName="goodsStatus", label="商品状态 1表示已下架 2表示上架中"),
		@Column(name="content", attrName="content", label="商品内容"),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class NatatoriumGoods extends DataEntity<NatatoriumGoods> {
	
	private static final long serialVersionUID = 1L;
	private String natatoriumInfoId;		// 游泳馆id
	private String name;		// 商品名称
	private Long goodsType;		// 商品类型 1表示游泳票 2表示培训课程 3表示体验课程
	private String courseNumber;		// 课程人数
	private Date courseStartTime;		// 课程开始时间
	private Date courseEndTime;		// 课程结束时间
	private Double originalPrice;		// 原价
	private Double price;		// 价格
	private Long number;		// 库存数量
	private Long sellNumber;		// 已售数量
	private Date useFinishTime;		// 使用截至时间
	private Date upSellTime;		// 上架时间
	private Date downSellTime;		// 下架时间
	private Long goodsStatus;		// 商品状态 1表示已下架 2表示上架中
	private String content;		// 商品内容
	
	//################## 附加字段 #######################
	private List<String> natatoriumGoodsImageUrlList = new ArrayList<String>();	//商品图片url集合

	public NatatoriumGoods() {
		this(null);
	}

	public List<String> getNatatoriumGoodsImageUrlList() {
		return natatoriumGoodsImageUrlList;
	}

	public void setNatatoriumGoodsImageUrlList(List<String> natatoriumGoodsImageUrlList) {
		this.natatoriumGoodsImageUrlList = natatoriumGoodsImageUrlList;
	}

	public NatatoriumGoods(String id){
		super(id);
	}
	
	public Date getCourseStartTime() {
		return courseStartTime;
	}

	public void setCourseStartTime(Date courseStartTime) {
		this.courseStartTime = courseStartTime;
	}

	public Date getCourseEndTime() {
		return courseEndTime;
	}

	public void setCourseEndTime(Date courseEndTime) {
		this.courseEndTime = courseEndTime;
	}

	@NotBlank(message="游泳馆id不能为空")
	@Length(min=0, max=64, message="游泳馆id长度不能超过 64 个字符")
	public String getNatatoriumInfoId() {
		return natatoriumInfoId;
	}

	public void setNatatoriumInfoId(String natatoriumInfoId) {
		this.natatoriumInfoId = natatoriumInfoId;
	}
	
	@NotBlank(message="商品名称不能为空")
	@Length(min=0, max=500, message="商品名称长度不能超过 500 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Length(min=0, max=500, message="课程人数长度不能超过 500 个字符")
	public String getCourseNumber() {
		return courseNumber;
	}

	public void setCourseNumber(String courseNumber) {
		this.courseNumber = courseNumber;
	}
	
	public Double getOriginalPrice() {
		return originalPrice;
	}

	public void setOriginalPrice(Double originalPrice) {
		this.originalPrice = originalPrice;
	}

	@NotNull(message="价格不能为空")
	public Double getPrice() {
		//折扣价为空，返回原价 2025/2/10
		if (price == null)
			return originalPrice;
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}
	
	public Long getNumber() {
		return number;
	}

	public void setNumber(Long number) {
		this.number = number;
	}
	
	public Long getSellNumber() {
		return sellNumber;
	}

	public void setSellNumber(Long sellNumber) {
		this.sellNumber = sellNumber;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	@NotNull(message="使用截至时间不能为空")
	public Date getUseFinishTime() {
		return useFinishTime;
	}

	public void setUseFinishTime(Date useFinishTime) {
		this.useFinishTime = useFinishTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getUpSellTime() {
		return upSellTime;
	}

	public void setUpSellTime(Date upSellTime) {
		this.upSellTime = upSellTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDownSellTime() {
		return downSellTime;
	}

	public void setDownSellTime(Date downSellTime) {
		this.downSellTime = downSellTime;
	}
	
	@NotNull(message="商品状态不能为空")
	public Long getGoodsStatus() {
		return goodsStatus;
	}

	public void setGoodsStatus(Long goodsStatus) {
		this.goodsStatus = goodsStatus;
	}
	
	@NotNull(message="商品类型不能为空")
	public Long getGoodsType() {
		return goodsType;
	}

	public void setGoodsType(Long goodsType) {
		this.goodsType = goodsType;
	}

	@NotBlank(message="商品内容不能为空")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
}